<script setup lang="ts">
import {onMounted, ref, watch} from "vue";
import {FriendService, UserQueryCriteria, UserService, UserVo} from "/@/api/openapi";
import {ElMessage} from "element-plus";
import {useUserFriendStore, useUserStore} from "/@/store";
import {storeToRefs} from "pinia";

const tableRef = ref()
const tableData = ref<UserVo[]>();
const searchParams = ref<UserQueryCriteria>({
    pageNum: 1,
    pageSize: 10
});
const total = ref(0);
const userFriendStore = useUserFriendStore();
const store = useUserStore();
const {userFriend} = storeToRefs(userFriendStore);
const handleCurrentChange = (val: number) => {
    searchParams.value.pageNum = val
    loadData()
}
const loadData = async () => {
    await userFriendStore.updateUserFriend();
}
onMounted(() => {
    if (store.isSign) {
        loadData();
    }
})
</script>

<template>
    <div>
        <el-button @click="loadData" class="flesh">刷新</el-button>
        <el-table :ref="tableRef" :data="userFriend" style="width: 100%">
            <el-table-column prop="username" label="用户名称" width="180"/>
            <el-table-column prop="signature" label="签名" width="180"/>
            <el-table-column prop="email" label="邮箱" width="180"/>
            <el-table-column prop="phone" label="电话" width="180"/>
        </el-table>
    </div>
</template>

<style scoped>

</style>